 
<template>
	<view class="historical_report">
		<scroll-view scroll-x class="rep_scroll" >
			<table border  class="his_table">
					 <tr>
						 <th>时间</th>
						 <th v-for="item in hisRepListTit" :key="item">{{item}}</th> 
						 <th>操作</th>
					 </tr>
					 <tr v-for="v in hisRepList.data">
						 <td>{{v.date}} {{v.week}}</td>
						 <td v-for="i in v.text">{{i}}</td> 
						 <td @click="hisPepotrDetail(v)">
							 <text style="color: #2596ff;">
								 查看
							 </text>
						 </td>
					 </tr>
			</table>
		</scroll-view>
	  
	</view>
</template>

<script> 
	export default { 
		data() {
			return { 
				stationId: null,
				hisRepList: {},
				hisRepListTit:[
					'日产液t',
					'日产油t',
					'日产水t',
					'综合含水(质量法) : %',
					'日产气: Nm3/d'
				],
				returnPageTime: null
			};
		},
		onLoad({id}) {   
			this.stationId = id
		},
		mounted() {  
			this.getHistroyData()
		},
		methods: { 
			getHistroyData(){
				let _this = this
				this.$http({
					url: '/wxapi/ParameterListApi/getHistroyData', 
					data:{station_id: this.stationId}
				}).then(({code,data}) => {
					if(code == 200){
						_this.hisRepList = data    
						if(!data.data.length){ 
							uni.showToast({
								title: '暂无数据',
								icon:'none'
							})
							 clearInterval(_this.returnPageTime)
							_this.returnPageTime = setTimeout(() => {
								uni.navigateBack()
							},1500) 
						}
					} 
				})
			},
			// 查看详情
			hisPepotrDetail(v){  
				uni.navigateTo({
					url: '../hisRepDetail/index?report_id=' + v.report_id
				})
			}
		},
		onUnload(){
			clearInterval(this.returnPageTime)
		}
	}
</script>

<style lang="less" scoped>
	.historical_report {
		.his_table{ 
			margin-bottom: 18rpx;
			text-align: center;
			width: 1400rpx;
			border: none;
			tr {
				th,td {
					// width: 400rpx;
				}
			}
		}
	}
</style>
